﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QuantitativeInvestment.Bean;
namespace QuantitativeInvestment.Factor
{
    class PriceFactor:Factor
    {

        public PriceFactor()
        {

            this.name = "价格";
            Parameter p = new Parameter("类型", "收盘价");
            p.enumList.Add("最高价");
            p.enumList.Add("最低价");
            p.enumList.Add("均价");
            p.enumList.Add("开盘价");
            p.type = "enum";
            this.paraList.Add(p.name, p);

        }
    

        /// <summary>
        /// 给某只股票加入相应因子值
        /// </summary>
        /// <param name="stock"></param>
        /// <param name="para"></param>
        public override void addFactorValue(Stock stock)
        {
            string priceType = this.paraList["类型"].value.ToString();
            if (!stock.factors.ContainsKey(this.name + this.paraList["类型"].value.ToString()))
            {
                stock.factors.Add(this.name + this.paraList["类型"].value.ToString(), this.dataModel.getAdjustedStockPriceList(stock.startDate, stock.endDate, stock.code,priceType));
            }
        }
    }
}
